package com.example.demo.service;



import com.example.demo.entity.LikeMusicComment;
import com.example.demo.mapper.LikeMusicCommentMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LikeMusicCommentImpl implements LikeMusicCommentService {

    @Autowired

    private LikeMusicCommentMapper likeMusicCommentMapper;


    //点赞
    @Override
    public boolean insertLikeMusicComment(LikeMusicComment likeMusicComment){
        return likeMusicCommentMapper.insertLikeMusicComment(likeMusicComment) >0;
    }

    //取消点赞
    @Override
    public boolean deleteLikeMusicComment(LikeMusicComment likeMusicComment) {
        return likeMusicCommentMapper.deleteLikeMusicComment(likeMusicComment.getUser_id(), likeMusicComment.getMusic_comment_id()) > 0;
    }

    //查询是否已经点过赞
    @Override
    public boolean checkIfLike(Integer user_id, Integer music_comment_id) {
        return likeMusicCommentMapper.checkIfLike(user_id, music_comment_id) > 0;
    }

    //根据笔记id统计点赞数量
    @Override
    public Integer countLike(Integer music_comment_id){
        return likeMusicCommentMapper.countLike(music_comment_id);
    }

}